<?php
//引入链接数据库文件
require_once "./conn.php";
if (isset($_POST['save'])) {
    $username = $_POST['username'];
    $email = $_POST['email'];
    $mobile = $_POST['mobile'];
    //echo $username."---".$email."---".$mobile;
    //构造一个sql语句，插入数据
    $sql = 'insert into users(name,email,mobile) values("'.$username.'","'.$email.'","'.$mobile.'")';
    //$sql = "insert into users(name,email,mobile) values('$username','$email','$mobile')";
    //echo $sql
    if (mysqli_query($link,$sql)) {
        header("Location:index.php");
        exit;
    } else {
        echo 'Error:' .mysqli_error($link);
    }

    mysqli_close($link);
    
}
?>